/**
 * org.assess.oa.system.dao.impl.TbDepartmentDAOImpl
 */
package org.assess.oa.system.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.assess.core.dao.BaseDAOImpl;
import org.assess.oa.system.bean.TbDepartment;
import org.assess.oa.system.dao.TbDepartmentDAO;

/**
 * @description 操作部门表的DAO实现类
 * @author XiaLongxiang
 * @createtime 2012-5-7 上午12:31:36
 */
public class TbDepartmentDAOImpl extends BaseDAOImpl<TbDepartment> implements TbDepartmentDAO {
    public TbDepartment queryTbDepartmentByCode(String department_code, String valid_flag) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("department_code", department_code);
        map.put("valid_flag", valid_flag);
        return (TbDepartment) sqlClient.queryForObject("queryTbDepartmentByCode", map);
    }
    
    @SuppressWarnings("unchecked")
    public List<TbDepartment> queryTbDepartmentByUserCode(String user_code) {
        return sqlClient.queryForList("queryTbDepartmentByUserCode", user_code);
    }
    
    @SuppressWarnings("unchecked")
    public List<TbDepartment> queryTbDepartmentAsList(Map<String, Object> parameters) {
        return sqlClient.queryForList("queryTbDepartmentAsList", parameters);
    }
    
    public boolean updateTbDepartmentValid(TbDepartment tbDepartment) {
        int count = sqlClient.update("updateTbDepartmentValid", tbDepartment);
        return count > 0;
    }
}
